/**
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.kotvertolet.youtubejextractor;

import com.github.kotvertolet.youtubejextractor.models.AdaptiveAudioStream;
import com.github.kotvertolet.youtubejextractor.test.Args;
import com.github.kotvertolet.youtubejextractor.utils.CommonUtils;
import com.github.kotvertolet.youtubejextractor.utils.StringUtils;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;
import java.net.URLEncoder;
import static org.junit.Assert.assertEquals;

/**
 * ExampleOhosTest
 *
 * @author AnBetter
 * @since 2021-04-25
 */
public class ExampleOhosTest {
    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("com.github.kotvertolet.youtubejextractor", actualBundleName);
    }

    @Test
    public void urlDecode() {
        String url  = "https://developer.harmonyos.com/cn/home/";
        String res = StringUtils.urlDecode(URLEncoder.encode(url));
        assertEquals(res,url);
    }


    @Test
    public void urlParamsToJson() {
        String inputString = "a=b&c";
        String cases = "{\"a\":\"b\",\"c\"}";
        String res = StringUtils.urlParamsToJson(inputString);
        assertEquals(res,cases);
    }

    @Test
    public void getMatcher() {
        CommonUtils.getMatcher("1","1");
    }

    @Test
    public void getAudioChannels(){
        AdaptiveAudioStream adaptiveAudioStream = new AdaptiveAudioStream();
        adaptiveAudioStream.getAudioChannels();
    }

    @Test
    public void getAudioSampleRate(){
        AdaptiveAudioStream adaptiveAudioStream = new AdaptiveAudioStream();
        adaptiveAudioStream.getAudioSampleRate();
    }

    @Test
    public void getPlayerResponse(){
        Args args = new Args();
        args.getPlayerResponse();
    }

    @Test
    public void setPlayerResponse(){
        Args args = new Args();
        args.setPlayerResponse("1");
    }
}